package paa.simulator.heuristic;

import java.util.Comparator;

import paa.simulator.grafo.PessoaVertex;
import paa.simulator.grafo.simple.UndirectedSimpleGraph;

public class EdgeComparator implements Comparator<PessoaVertex> {

	private final UndirectedSimpleGraph<PessoaVertex> graph;

	public EdgeComparator(UndirectedSimpleGraph<PessoaVertex> graph) {
		this.graph = graph;
	}
	
	public int compare(PessoaVertex o1, PessoaVertex o2) {
		int edges1 = graph.edgesOf(o1).size();
		int edges2 = graph.edgesOf(o2).size();
		
		if (edges1 < edges2) {
			return -1;
		} else if (edges1 > edges2) {
			return 1;
		} else {
			return 0;
		}
	}
}